#include "../comm.h"
class Solution {
private:
    int n, m;
    int dirs[8][2] = {
        {1, 0}, {0, 1}, {1, 1}, {-1, -1},
        {-1, 0}, {0, -1}, {-1, 1}, {1, -1}
    };
    bool check(int x, int y) {
        return x >= 0 && x < 8 && y >= 0 && y < 8;
    }
public:
    bool checkMove(vector<vector<char>>& board, int rMove, int cMove, char color) {
        n = board.size(), m = board[0].size();
        auto checkTrue = [&](int dir) -> bool {
            int dx = dirs[dir][0], dy = dirs[dir][1];
            int c_n = cMove + dy, r_n = rMove + dx;
            char tar = color == 'B' ? 'W' : 'B';
            if (!check(r_n, c_n) || board[r_n][c_n] != tar) return false;
            for (int i = r_n, j = c_n; check(i, j); i += dx, j += dy)
                if (board[i][j] == '.') return false;
                else if (board[i][j] == color) return true;
            return false;
            };
        for (int i = 0; i < 8; ++i)
            if (checkTrue(i)) return true;
        return false;
    }
};